/*
 * Unidata Platform
 * Copyright (c) 2013-2020, UNIDATA LLC, All rights reserved.
 *
 * Commercial License
 * This version of Unidata Platform is licensed commercially and is the appropriate option for the vast majority of use cases.
 *
 * Please see the Unidata Licensing page at: https://unidata-platform.com/license/
 * For clarification or additional options, please contact: info@unidata-platform.com
 * -------
 * Disclaimer:
 * -------
 * THIS SOFTWARE IS DISTRIBUTED "AS-IS" WITHOUT ANY WARRANTIES, CONDITIONS AND
 * REPRESENTATIONS WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
 * IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY,
 * FITNESS FOR A PARTICULAR PURPOSE, DURABILITY, NON-INFRINGEMENT, PERFORMANCE AND
 * THOSE ARISING BY STATUTE OR FROM CUSTOM OR USAGE OF TRADE OR COURSE OF DEALING.
 */
package org.unidata.mdm.rest.meta.ro;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The Class SourceSystemsRO.
 */
public class SourceSystemsRO {

    /** The admin system name. */
    @JsonProperty(value = "adminSystemName")
    private String adminSystemName;

    /** The source system. */
    @JsonProperty(value = "sourceSystem")
    private List<SourceSystemRO> sourceSystem;

    /**
     * Gets the admin system name.
     *
     * @return the adminSystemName
     */
    public String getAdminSystemName() {
        return adminSystemName;
    }

    /**
     * Sets the admin system name.
     *
     * @param adminSystemName
     *            the adminSystemName to set
     */
    public void setAdminSystemName(String adminSystemName) {
        this.adminSystemName = adminSystemName;
    }

    /**
     * Gets the source system.
     *
     * @return the sourceSystem
     */
    public List<SourceSystemRO> getSourceSystem() {
    	if (sourceSystem == null) {
    	    sourceSystem = new ArrayList<>();
    	}
    	return sourceSystem;
    }

    /**
     * Adds the source system.
     *
     * @param sourceSystemDefinition
     *            the source system definition
     */
    public void addSourceSystem(SourceSystemRO sourceSystemDefinition) {
    	if (sourceSystem == null) {
    	    sourceSystem = new ArrayList<>();

    	}
    	sourceSystem.add(sourceSystemDefinition);
    }

    /**
     * Sets the source system.
     *
     * @param sourceSystem
     *            the sourceSystem to set
     */
    public void setSourceSystem(List<SourceSystemRO> sourceSystem) {
        this.sourceSystem = sourceSystem;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
    	final int prime = 31;
    	int result = 1;
    	result = prime * result
    		+ ((adminSystemName == null) ? 0 : adminSystemName.hashCode());
    	result = prime * result
    		+ ((sourceSystem == null) ? 0 : sourceSystem.hashCode());
    	return result;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
    	if (this == obj)
    	    return true;
    	if (obj == null)
    	    return false;
    	if (getClass() != obj.getClass())
    	    return false;
    	SourceSystemsRO other = (SourceSystemsRO) obj;
    	if (adminSystemName == null) {
    	    if (other.adminSystemName != null)
    		return false;
    	} else if (!adminSystemName.equals(other.adminSystemName))
    	    return false;
    	if (sourceSystem == null) {
    	    if (other.sourceSystem != null)
    		return false;
    	} else if (!sourceSystem.equals(other.sourceSystem))
    	    return false;
    	return true;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
    	StringBuilder builder = new StringBuilder();
    	builder.append("SourceSystemsRO [adminSystemName=");
    	builder.append(adminSystemName);
    	builder.append(", sourceSystem=");
    	builder.append(sourceSystem);
    	builder.append("]");
    	return builder.toString();
    }
}
